package com.crazy.enums;

import java.util.Arrays;

public enum StatusCode {
    CODE300("300","权限不足"), CODE404("404","找不到指定页面");
    private String code;
    private String message;

    StatusCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static StatusCode getByCode(String code) {
        StatusCode[] statusCodes = StatusCode.values();
        for(StatusCode statusCode : statusCodes){
            if(code.equals(statusCode.getCode())){
                return statusCode;
            }
        }
        return null;
    }
}
